﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace background.Manager.Content.Action {
    /// <summary>
    /// group 的摘要说明
    /// </summary>
    public class group: IHttpHandler {

        public void ProcessRequest(HttpContext context) {
            context.Response.ContentType = "text/plain";
            HttpRequest r=context.Request;
            string ret=string.Empty;
            switch(r["action"].ToString()) {
                case "add":
                    ret= Codes.ContentGroup.add(r["title"], r["pyName"], r["state"], r["order"], r["group"]).ToString().ToLower();
                    break;
                case "update":
                    ret= Codes.ContentGroup.update( r["id"],r["title"], r["pyName"], r["state"], r["order"], r["group"]).ToString().ToLower();
                    break;
                case "delete":
                    ret= Codes.ContentGroup.deleteMass(r["idList"]).ToString().ToLower();
                    break;
                case "getInfo":
                    ret=Codes.h.getJson(Codes.ContentGroup.getInfo(r["id"]));
                    break;
                case "changeOrder":
                    ret= Codes.ContentGroup.changeOrder(int.Parse(r["order"]), int.Parse(r["id"])).ToString().ToLower();
                    break;
            }
            context.Response.Write(ret);
        }

        public bool IsReusable {
            get {
                return false;
            }
        }
    }
}